/**
 * @file field
 * @author fanxueliang@qq.com
 */
import type {NumberSpecItem, NumberLikeField} from '../interface';
import {getBasicField} from '../util';

export function createNumberField(spec: NumberSpecItem, showIndex: number, path: string) {
    let component = 'NumberInput';
    if (spec.ui) {
        component = spec.ui;
    }
    const basicField = getBasicField(spec, path, showIndex);
    return {
        ...basicField,
        type: 'NUMBER',
        isLeaf: true,
        spec,
        component
    } as NumberLikeField;
}
